FROM centos:7
MAINTAINER hanbaga <wengao.han@gmail.com>

COPY res/bin/ngx-conf-parser /bin/ngx-conf-parser
RUN chmod +x /bin/ngx-conf-parser
RUN mkdir -p /root/nginx
RUN mkdir -p /usr/local/nginx/logs
COPY res/conf /root/nginx/conf

RUN yum install -y tar gcc automake autoconf libtool make
COPY res/ucspi-tcp-0.88.tar.gz /opt/
RUN tar -xvf /opt/ucspi-tcp-0.88.tar.gz -C /opt/
RUN make --dir /opt/ucspi-tcp-0.88/
RUN make check --dir /opt/ucspi-tcp-0.88/

RUN /bin/rm -rf /opt/ucspi-tcp-0.88.tar.gz

COPY res/parse-config.sh opt/

EXPOSE 80

CMD /opt/ucspi-tcp-0.88/tcpserver 0.0.0.0 80 /opt/parse-config.sh
